package com.starbucks.opencase.service;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.starbucks.opencase.enums.enumCMKey;
import com.starbucks.opencase.enums.enumCMMark;
import com.starbucks.opencase.function.funSession;
import com.starbucks.opencase.function.funUserTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class serUserBusinessman {
    @Autowired
    private funUserTest funUserTest;
    @Autowired
    private funSession funSession;
    public void applyAddFriend(String id, JsonNode message){
        ObjectMapper om=new ObjectMapper();
        ObjectNode on=om.createObjectNode();
        on.put(enumCMKey.mark.name(), enumCMMark.applyAppFriend.ordinal());
        on.put(enumCMKey.timestamp.name(), System.currentTimeMillis());
        on.put(enumCMKey.status.name(), false);
        if(!funSession.isOnlineOfId(id,on))return;
        if(!funUserTest.hasUID(id,message,on))return;
//        if()
    }
}
